package com.inspur.edp.rule.dsl.core.function.list.getter;

import com.inspur.edp.cef.entity.entity.ICefData;
import com.inspur.edp.rule.dsl.core.function.list.IGetFieldValue;

public class CefDataGetter implements IGetFieldValue {

    private ICefData cefData;

    private String fieldName;

    public CefDataGetter(Object cefData, String fieldName) {
        this.cefData = (ICefData) cefData;
        this.fieldName = fieldName;
    }

    @Override
    public Object getFieldValue(Object object) {
        return this.cefData.getValue(fieldName);
    }

    @Override
    public String getString(Object object) {
        return (String) this.getFieldValue(object);
    }

    @Override
    public Number getNumber(Object object) {
        return (Number) this.getFieldValue(object);
    }
}
